import argparse
import fileinput
import json

import pandas as pd
from more_itertools import chunked

parser = argparse.ArgumentParser()
parser.add_argument(
    "input",
    type=str,
)
parser.add_argument(
    "--name",
    type=str,
)
args = parser.parse_args()


df = pd.read_excel(".vscode/test.xlsx")

five_suggestions = []
for responses in chunked(fileinput.input(args.input), 5):
    responses = [json.loads(item)["answer"] for item in responses]
    five_suggestions.append("\n".join(responses))

df[args.name] = five_suggestions
df.to_excel(".vscode/test.xlsx", index=False)
